﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Bosphorus.Migrator.Dialect.NVelocity
{
    public class NVelocityModel
    {
        private readonly object model;
        private readonly string dialectResult;
        private readonly IDictionary<string, ModelNVelocityModelListDictionary> actionDictionary;

        public NVelocityModel(object model)
            : this(model, string.Empty)
        {
            
        }

        public NVelocityModel(object model, string dialectResult)
        {
            this.model = model;
            this.dialectResult = dialectResult;
            this.actionDictionary = new Dictionary<string, ModelNVelocityModelListDictionary>();
        }

        public object Model
        {
            get { return model; }
        }

        public string DialectResult
        {
            get { return dialectResult; }
        }

        public ModelNVelocityModelListDictionary this[string actionName]
        {
            get
            {
                if (actionDictionary.ContainsKey(actionName))
                    return actionDictionary[actionName];

                ModelNVelocityModelListDictionary modelNVelocityModelListDictionary = new ModelNVelocityModelListDictionary();
                actionDictionary.Add(actionName, modelNVelocityModelListDictionary);

                return modelNVelocityModelListDictionary;
            }
        }
    }
}
